package com.example.petstore.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.petstore.domain.LineItem;
import com.example.petstore.domain.Order;
import com.example.petstore.mapper.LineItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service("lineItemService")
public class LineItemService {
    @Autowired
    private LineItemMapper lineItemMapper;

    public List<LineItem> getLineItemsByOrderId(int orderId) {
        return lineItemMapper.selectList(new QueryWrapper<LineItem>().eq("orderid", orderId));
    }
}
